package cat.joronya.supermanager.service;

import android.util.Log;

public class PrivateLeagueJoinParser 
{
	private static final String TAG = "supermanager";
	
	private static final String WRONG_PASSWORD = "La clave no es correcta";
	private static final String MAX_TEAMS = "Esta Liga Privada no admite más equipos.";
	private static final String MAX_TEAMS_PLAYER = "En esta Liga Privada cada socio debe tener un máximo de";
	
	public void parse(String html) throws Exception
	{
		if( html.contains(WRONG_PASSWORD) )
			throw new PrivateLeagueWrongPasswordException();
		
		if( html.contains(MAX_TEAMS) )
			throw new MaximumTeamsReachedException();
		
		if( html.contains(MAX_TEAMS_PLAYER) )
			throw new MaximumTeamsPerPlayerReachedException();
			
		// parsejat ok
		Log.d(TAG, "PrivateLeagueSearchParser: private league join password check parsed ok");
		return;
	}
}
